﻿using System;
using System.Activities;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WFExtended.Twitter.Activities.Designers;

namespace WFExtended.Twitter.Activities
{
    /// <summary>
    /// Returns the list of suggested user categories
    /// </summary>
    [ToolboxBitmapAttribute(typeof(EntryPoint), "Resources.SuggestedUserToolbox.bmp")]
    [Designer(typeof(GetSuggestedUserCategoriesDesigner))]
    [Description("Returns the list of suggested user categories.")]
    public class GetSuggestedUserCategories : TwitterOperationInvoker<List<SuggestedUserCategory>>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="GetSuggestedUserCategories"/> class.
        /// </summary>
        public GetSuggestedUserCategories()
            : base("GetSuggestedUserCategories")
        { }

        /// <summary>
        /// Gets or sets the lang to restricts Suggested User Categories to the given language
        /// <remarks>
        /// ISO 639-1 code, Example Values: fr
        /// </remarks>
        /// </summary>
        /// <value>
        /// The code lang
        /// </value>
        [Browsable(true)]
        [Category("Parameters")]
        [Description("The code lang")]
        public InArgument<string> Lang { get; set; }

        /// <summary>
        /// Caches the metadata.
        /// </summary>
        /// <param name="metadata">The metadata.</param>
        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            RuntimeArgument langArgument = new RuntimeArgument("Lang", typeof(string), ArgumentDirection.In, false);
            metadata.Bind(Lang, langArgument);
            metadata.AddArgument(langArgument);

            base.CacheMetadata(metadata);
        }

        /// <summary>
        /// Executes the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void Execute(NativeActivityContext context)
        {
            Parameters.Clear();

            Parameters.Add("lang", Lang);

            base.Execute(context);
        }
    }
}
